<template>
  <div class="home-new-goods-list">
    <van-cell-group>
      <van-cell title="新品首发" is-link value="更多新品首发" />
    </van-cell-group>
    <van-grid :column-num="2">
      <van-grid-item
        v-for="item in newGoodsList"
        :key="item.id"
        :icon="item.picUrl"
        :text="item.name"
        @click="onHref(item.id)"
      />
    </van-grid>
  </div>
</template>

<script setup>
import { defineProps } from "vue";
import { useRouter } from 'vue-router'; 

const router = useRouter();
const props = defineProps({
  newGoodsList: {
    type: Array,
    default: [],
  },
});

const onHref = (id) => {
  console.log(id);
  router.push({ name: "Goods", params: { id } });
}
</script>

<style scoped lang="scss">
::v-deep .van-icon__image {
  width: 280px;
  height: 280px;
}
</style>
